<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Animoso.Domain.Event>>" %>
<%@ Import Namespace="Animoso.Domain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%=ViewData["agendaTitle"] %></h2>
    <p><%=ViewData["agendaDescription"] %></p><br />
    <%
        bool nextYear = false;
        for (var datum = DateTime.Now; datum < DateTime.Now.AddYears(1); datum = datum.AddMonths(1))
        {
            if(datum.Year != DateTime.Now.Year && !nextYear)
            {
                nextYear = true; %>
                <h4><%=datum.Year.ToString() %></h4>
            <% }
            %><span class="EventMaand"><%=Html.Encode(datum.ToString("MMMM"))%></span>
            <p>
            <%
            IEnumerable<Event> currentEvents = Model.Where(x => x.DateTime.Month.Equals(datum.Month))
                .Where(x => x.DateTime.Year == datum.Year);
            foreach (var eventItem in currentEvents.OrderBy(x => x.DateTime))
            {%>
                <span class="EventDatumGroot"><%=Html.Encode(eventItem.DateTime.ToLongDateString()) %></span><br />
                <span class="EventItemGroot"><%=Html.Encode(eventItem.Name)%></span><br />
                <span class="EventBeschrijving"><%=Html.Encode(eventItem.Description) %></span><br /><br />
            <%}%>
            </p><br />
        <%}%>
</asp:Content>
